#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
    int n;
    while(cin>>n&&n<=50&&n>0){
        int k;
        string name;
        for(int j=0;j<n;j++){
        double credit,score,sum=0.0;
        int flag=0;
        double GPA=0.0;
        cin>>k;
        for(int i=0;i<k;i++){
            cin>>name>>credit>>score;
            if(score<60&&score>=0) flag=1;
            GPA+=credit*score;
            sum+=credit;
        }
        GPA=GPA/sum;
        if (j != 0)cout << endl;
        if(flag){
            cout<<"Sorry!"<<endl;
        }else
        cout<<fixed<<setprecision(2)<<GPA<<endl;
    }
    }
    return 0;
}